package de.pixelate.flixelprimer 
{
	import org.flixel.*;
	
	public class Ship extends FlxSprite
	{
		[Embed(source="../../../../assets/png/Ship.png")]
		private var ImgShip:Class;
		
		public function Ship():void
		{
			super(150, 300, ImgShip);
		}
		public function getBulletSpawnPosition(offset:int):FlxPoint
		{
trace(this.height);
			var p: FlxPoint = new FlxPoint(x + 10, y+(this.height/2) + offset);
			return p;
		}		
		override public function update():void
		{
			velocity.x = 0;
			velocity.y = 0;
			
			if(FlxG.keys.LEFT)
			{
				velocity.x = -250;
			}
			else if(FlxG.keys.RIGHT)
			{
				velocity.x = 250;
			}
			
			if(FlxG.keys.UP)
			{
				velocity.y = -250;
			}
			else if(FlxG.keys.DOWN)
			{
				velocity.y = 250;
			}
			if(x > FlxG.width-width-16)
			{
				x = FlxG.width-width-16;
			}
			else if(x < 16)
			{
				x = 16;
			}
			
			if(y > FlxG.height-height-16)
			{
				y = FlxG.height-height-16;
			}
			else if(y < 16)
			{
				y = 16;
			}			
			
			super.update();
		}
	}
	
}